package edu.upf.opencities.web.action;

import java.util.Map;
 
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import org.apache.struts2.util.ServletContextAware;
 
import com.opensymphony.xwork2.ActionSupport;
 
public class BaseAction extends ActionSupport implements ServletContextAware,
        SessionAware, ServletRequestAware, ServletResponseAware {
 
	private static final long serialVersionUID = 1L;
	protected ServletContext context = null;
    protected Map<String, Object> session = null;
    private static HttpServletRequest request = null;
    private static HttpServletResponse response = null;
 
    @Override
    public void setServletContext(ServletContext context) {
        this.context = context;
    }
 
    @Override
    public void setSession(Map<String, Object> session) {
        this.session = session;
 
    }
 
    @Override
    public void setServletRequest(HttpServletRequest request) {
        BaseAction.setRequest(request);
    }
 
    @Override
    public void setServletResponse(HttpServletResponse response) {
        BaseAction.setResponse(response);
    }

	public static HttpServletRequest getRequest() {
		return request;
	}

	public static void setRequest(HttpServletRequest request) {
		BaseAction.request = request;
	}

	public static HttpServletResponse getResponse() {
		return response;
	}

	public static void setResponse(HttpServletResponse response) {
		BaseAction.response = response;
	}
 
}